package com.hdax.dm.mapstrucs;

import com.hdax.dm.dto.ScheduleDto;
import com.hdax.dm.dto.ScheduleDto.*;
import com.hdax.dm.entity.scheduler.DmScheduler;
import com.hdax.dm.entity.scheduler.DmSchedulerSeat;
import com.hdax.dm.entity.scheduler.DmSchedulerSeatPrice;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public abstract class ScheduleDtoMapper {

    protected String turnToString(Long areaLevel){
        if(areaLevel == 1) return "A";
        if(areaLevel == 2) return "B";
        if(areaLevel == 3) return "C";
        return null;
    }
    @Mapping(target = "areaLevel",expression = "java(turnToString(scheduler.getAreaLevel()))")
    public abstract ScheduleDto.SeatInfoDto seatToTarget(DmSchedulerSeat scheduler);


    public abstract List<ScheduleDto.SeatInfoDto> seatToTargets(List<DmSchedulerSeat> schedulers);

    public abstract ScheduleDto.SeatPriceDto priceToTarget(DmSchedulerSeatPrice price);

    public abstract List<ScheduleDto.SeatPriceDto> priceToTargets(List<DmSchedulerSeatPrice> prices);
}
